﻿Ext.define('Examples.tree.menuitem.view.Tree', {
    extend: 'Happy.tree.Panel',
    alias: 'widget.menuitem-tree',
    requires: [
        'Happy.table.action.Refresh',
        'Happy.table.action.New',
        'Happy.table.action.Edit',
        'Happy.tree.action.Delete',
        'Examples.tree.menuitem.store.TreeStore',
        'Examples.tree.menuitem.view.Form',
    ],

    columns: [
        {
            xtype: 'treecolumn',
            text: 'Name',
            dataIndex: 'Name',
            flex: 1,
            width: 150
        }
    ],

    initComponent: function () {
        var me = this;

        me.store = Ext.create('Examples.tree.menuitem.store.TreeStore');

        me.tbar = Happy.createActions([
            'refresh',
            {
                type: 'new',
                showStrategy: {
                    title: 'new form',
                    formType: 'menuitem-form'
                }
            },
            {
                type: 'edit',
                remoteLoad: false,
                showStrategy: {
                    title: 'edit form',
                    formType: 'menuitem-form'
                }
            },
            'tree-delete'
        ]);

        me.callParent(arguments);
    }
});